export class LanguageCodeAdapter {
  private static readonly languageMap: object = {
    '自动': 'auto',
    '中文': 'zh',
    '英语': 'en',
    '法语': 'fra',
    '德语': 'de',
    '日语': 'jp',
    '韩语': 'kor'
  };

  // 根据语言名称获取语言代码
  public static getCode(languageName: string): string | undefined {
    return this.languageMap[languageName];
  }

  // 根据语言代码获取语言名称（可选）
  public static getName(languageCode: string): string | undefined {
    const reversedMap = Object.fromEntries(
      Object.entries(this.languageMap).map(([key, value]) => [value, key])
    );
    return reversedMap[languageCode];
  }
}
